// PayType.java
package com.health.common.enums;

/**
 * 支付方式枚举
 */
public enum PayType {
    ALIPAY("1", "支付宝"),
    WECHAT("2", "微信"),
    BANK_CARD("3", "银行卡");

    private final String code;
    private final String desc;

    PayType(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static PayType getByCode(String code) {
        for (PayType payType : values()) {
            if (payType.getCode().equals(code)) {
                return payType;
            }
        }
        return null;
    }

    public static String getDescByCode(String code) {
        PayType payType = getByCode(code);
        return payType != null ? payType.getDesc() : "未知支付方式";
    }
}